package 算法;

/**
 * Created by zzy on 2018/4/25.
 */
public class 删除排序数组中的重复项 {

    public int removeDuplicates(int[] nums) {
          if(nums.length<=0){
              return 0;
          }
          int idx=1;
          for(int i=1;i<nums.length;i++){
              if(nums[i]!=nums[i-1]){
                  nums[idx++]=nums[i];
              }
          }
          return idx;
    }
}
